package com.xwltz.common.phone.base;

import lombok.Getter;

import java.util.Arrays;
import java.util.Optional;

/**
 * @description AlgorithmEnum
 * @information on version 1.0 be created by @xwltz at 2021/11/08 17:18
 */

public enum AlgorithmEnum {
	AnotherBinary(1, "AnotherBinarySearch"),
	Binary(2, "BinarySearch"),
	ProspectBinary(3, "ProspectBinarySearch"),
	Sequence(4, "Sequence");

	/**
	 * 获取中文名
	 */
	@Getter
	private final Integer code;
	@Getter
	private final String describe;

	AlgorithmEnum(Integer code, String describe) {
		this.code = code;
		this.describe = describe;
	}

	public static Optional<AlgorithmEnum> of(int value) {
		return Arrays.stream(values()).filter(v -> v.code == value).findAny();
	}
}
